prepareEndRental

open override fun prepareEndRental(deviceName: String, onUpdate: (ConnectionUpdate) -> Unit, onResult: (Result<PrepareEndRentalSuccess>) -> Unit)

For preparing Donkey bike for end rental, use this function. prepareEndRental invokes checking of the lock state including the bike.donkey.lockkit.updates.ConnectionUpdate.ExtraLockCheck - necessary operation before ending rental to make sure the vehicle is safe from any misuse. In the case of lock being unlocked, this function will try to lock it as well. Note however that this does not end the rental. Remember to call the required endpoint on TOMP.

Parameters

deviceName

String value of the given lock device name for bluetooth communication

onUpdate

callback provides different ConnectionUpdates for the app to display progress

onResult

callback provides the PrepareEndRentalSuccess if it was successful, or Throwable in the case of any errors

Throws

UninitializedSdkError

(bike.donkey.lockkit.errors.UninitializedSdkError) is thrown if the SDK has not been successfully initialized